﻿using KAs.Api;
using KAs.Application.Contract.Dto;
using KAs.Common.Const;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RN.Note.Application.Contract.Dto;
using RN.Note.Application.Contract.Svc;
using RN.Note.Domain;

namespace RN.Note.Api
{
    [Route(ConstConfig.API_ROUTE_CONFIG)]
    [ApiController]
    public class NoteController : CommonCurdController<long, ReadingNote, ReadingNoteCreateDto, ReadingNoteCreateDto, ReadingNoteDto>
    {
        private new readonly INoteAppService _appService;
        public NoteController(INoteAppService appService) : base(appService)
        {
            _appService = appService;
        }

        /// <summary>
        /// 上传封面图片
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<string> UploadCoverImage([FromForm] IFormFile file)
        {
            var result = ApiResult<string>.IsSuccess();
            result.Data = _appService.UploadCoverImage(file);
            return result;
        }
    }
}